package day15;

import javax.swing.*;

/**
 * @author oldliu
 * @since 1.0
 *
 */
public class MyJFrame extends JFrame {
    public MyJFrame(String title){
        super(title);
        this.setLayout(null);
        JButton button1=new JButton("点击");
        button1.setBounds(10,10,120,40);
        super.add(button1);

        JTextField jt=new JTextField(12);

        jt.setBounds(140,10,130,40);
        super.add(jt);

        button1.addActionListener((e)->{
            System.out.println("按钮被点击了。。。"+jt.getText());
        });
    }

    public static void main(String[] args) {
        MyJFrame j=new MyJFrame("我的swing案例");
        j.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);


        j.setSize(800,600);
        j.setVisible(true);
    }
}
